//
//  JSQVoiceStateView.m
//  Conversation
//
//  Created by C_HAO on 15/9/25.
//  Copyright © 2015年 CHAOO. All rights reserved.
//

#import "JSQVoiceStateView.h"
#import <AVFoundation/AVFoundation.h>
#import "UIImage+JSQMessages.h"

@implementation JSQVoiceStateView

- (void)awakeFromNib {
    [super awakeFromNib];

    _imageView.image = [UIImage jsq_bubbleRecordImage];
    _cancelImageView.image = [UIImage jsq_bubbleCancelImage];
//    _InstructionsImageView.image = [UIImage jsq_bubbleIndicateImage:@"yinjie"];
    _cancelImageView.hidden = YES;
}

- (void)setVoiceStateType:(JSQVoiceStateType)voiceStateType {
    _voiceStateType = voiceStateType;

    switch (voiceStateType) {
    case JSQVoiceStateBegin: {
        _imageView.hidden = NO;
        _InstructionsImageView.hidden = NO;
        _cancelImageView.hidden = YES;
        _label.text = @"手指上滑，取消发送";
        break;
    }
    case JSQVoiceStateSend: {
        _imageView.hidden = NO;
        _InstructionsImageView.hidden = NO;
        _cancelImageView.hidden = YES;
        _label.text = @"发送...";
        break;
    }
    case JSQVoiceStateCancel: {
        _imageView.hidden = YES;
        _InstructionsImageView.hidden = YES;
        _cancelImageView.hidden = NO;
        _label.text = @"取消发送";
        break;
    }
    case JSQVoiceStateMoveIn: {
        _imageView.hidden = NO;
        _InstructionsImageView.hidden = NO;
        _cancelImageView.hidden = YES;
        _label.text = @"手指上滑，取消发送";
        break;
    }
    case JSQVoiceStateMoveOuter: {
        _imageView.hidden = YES;
        _InstructionsImageView.hidden = YES;
        _cancelImageView.hidden = NO;
        _label.text = @"松开手指，取消发送";
        break;
    }
    case JSQVoiceStateFailed: {
        _imageView.hidden = NO;
        _InstructionsImageView.hidden = NO;
        _cancelImageView.hidden = YES;
        _label.text = @"失败";
        break;
    }
    case JSQVoiceStateShortTime: {
        _imageView.hidden = YES;
        _InstructionsImageView.hidden = YES;
        _cancelImageView.hidden = NO;
        _label.text = @"录音时间间隔较短";
        break;
    }
    default:
        break;
    }
}

@end
